package util;

import java.util.Random;

import static org.junit.Assert.assertEquals;

public class Util {
    public static void assertEqual(int[] randomArray, int[] copyArray) {
        assertEquals(randomArray.length, copyArray.length);
        for (int i = 0; i < randomArray.length; i++) {
            assertEquals(randomArray[i], copyArray[i]);
        }
    }

    public static int[] copyArray(int[] array) {
        int[] result = new int[array.length];
        for (int i = 0; i < array.length; i++) {
            result[i] = array[i];
        }
        return result;
    }

    public static void print(int[] array) {
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + ",");
        }
        System.out.println();
    }

    public static int[] createRandomArray() {
        int N = new Random().nextInt(100);
        int[] array = new int[N];
        for (int i = 0; i < N; i++) {
            array[i] = new Random().nextInt(100) - new Random().nextInt(100);
        }
        return array;
    }
}
